package controller

import (
	"errors"
	"github.com/gin-gonic/gin"
	"k9-panel/app/adapter/http/middleware"
	"k9-panel/app/service/dto"
)

type common struct {
}

func (cm *common) GetLoginUser(c *gin.Context) (*dto.User, error) {
	//claims := jwt.ExtractClaims(c)
	value, exists := c.Get(middleware.IdentityKey)
	if !exists {
		return nil, errors.New("未登录！")
	}
	user := value.(*dto.User)
	return user, nil

}
